# -*- coding: utf-8 -*-


class BloomFilter(object):
    def __init__(self, size):
        super(BloomFilter, self).__init__()
        self._val = [False] * size
        self._size = size

    def hash(self, val):
        return hash(val) % self._size

    def add(self, val):
        h = self.hash(val)
        self._val[h] = True

    def might_has(self, val):
        h = self.hash(val)
        return self._val[h]

    def dump(self):
        print(self._val)
